package com.example.fresheveryday.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.example.fresheveryday.po.Comment;
import com.example.fresheveryday.po.Viewhistory;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author ll
 * @since 2023-07-05
 */
@Mapper
public interface ViewhistoryMapper extends BaseMapper<Viewhistory> {
    @Select("select * from viewhistory ${ew.customSqlSegment}")
    @Results({
            @Result(column = "id",property = "id",id = true),
        @Result(column = "productid",property = "productname",one=@One(select = "com.example.fresheveryday.mapper.ProductMapper.selectById"))
    })
    public IPage<Viewhistory> getHis(IPage<Viewhistory> page, @Param("ew") Wrapper wrapper);
    @Select("select count(id) from viewhistory ${ew.customSqlSegment}")
    int countByConditions(@Param("ew") Wrapper wrapper);
}
